import React, { PureComponent } from 'react'


class LoginPage extends PureComponent {
  render() {
    return (
      <div>
        <h2>登录页面</h2>
      </div>
    )
  }
}



function withAuth(WrapperComponent) {
  return props => {
    if (props.isLogin) {
      return <WrapperComponent  {...props} />
    } else {
      return <LoginPage />
    }
  }
}


// 购物车组件
class CartPage extends PureComponent {
  render() {
    return <h2>购物车页面</h2>
  }
}

const AuthCartPage = withAuth(CartPage)


export default class App extends PureComponent {
  render() {
    return (
      <div>
        <AuthCartPage isLogin={false}></AuthCartPage>
      </div>
    )
  }
}
